Skip to content

Pass decoder options to the underlying decoder when reading from files and buffers, not just URLs#1357

Open
DefiantCatgirl wants to merge 1 commit intojimp-dev:mainfrom
DefiantCatgirl:fix/1356-always-pass-decoder-options
Open

Pass decoder options to the underlying decoder when reading from files and buffers, not just URLs#1357
DefiantCatgirl wants to merge 1 commit intojimp-dev:mainfrom
DefiantCatgirl:fix/1356-always-pass-decoder-options

Conversation

@DefiantCatgirl
Copy link

What's Changing and Why

This should fix #1356

This ensures that decoder options are passed regardless of where Jimp reads an image from. Right now, the options are only passed if Jimp reads an image from a URL, but not when it reads it from a file or from a buffer.

Without this, it is sometimes impossible to read large JPEG files (~8k resolution) from files or buffers, as reading a large JPEG can fail with a memory allocation error unless a high enough maxMemoryUsageInMB value is passed to the js-jpeg decoder (by default its memory usage is limited to only 512 MB).

What else might be affected

Hopefully nothing.

Tasks

  • Add tests
  • Update Documentation
  • Update jimp.d.ts
  • Add SemVer Label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decoder options are not passed to the underlying decoder when using Jimp.read() for buffers or files

1 participant